home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / languages / pcq_incl3v1.lha / Devices / HardBlocks.i < prev    next >
Encoding:
Text File  |  1994-06-12  |  10.6 KB  |  231 lines

  1. {
  2.         HardBlocks.i for PCQ Pascal
  3.  
  4.         File System identifier blocks for hard disks
  5. }
  6.  
  7. {--------------------------------------------------------------------
  8.  *
  9.  *      This file describes blocks of data that exist on a hard disk
  10.  *      to describe that disk.  They are not generically accessable to
  11.  *      the user as they do not appear on any DOS drive.  The blocks
  12.  *      are tagged with a unique identifier, checksummed, and linked
  13.  *      together.  The root of these blocks is the RigidDiskBlock.
  14.  *
  15.  *      The RigidDiskBlock must exist on the disk within the first
  16.  *      RDB_LOCATION_LIMIT blocks.  This inhibits the use of the zero
  17.  *      cylinder in an AmigaDOS partition: although it is strictly
  18.  *      possible to store the RigidDiskBlock data in the reserved
  19.  *      area of a partition, this practice is discouraged since the
  20.  *      reserved blocks of a partition are overwritten by "Format",
  21.  *      "Install", "DiskCopy", etc.  The recommended disk layout,
  22.  *      then, is to use the first cylinder(s) to store all the drive
  23.  *      data specified by these blocks: i.e. partition descriptions,
  24.  *      file system load images, drive bad block maps, spare blocks,
  25.  *      etc.
  26.  *
  27.  *      Though only 512 byte blocks are currently supported by the
  28.  *      file system, this proposal tries to be forward-looking by
  29.  *      making the block size explicit, and by using only the first
  30.  *      256 bytes for all blocks but the LoadSeg data.
  31.  *
  32.  *------------------------------------------------------------------}
  33.  
  34. {
  35.  *  NOTE
  36.  *      optional block addresses below contain $ffffffff to indicate
  37.  *      a NULL address, as zero is a valid address
  38. }
  39.  
  40. type
  41.  
  42.     RigidDiskBlock = record
  43.         rdb_ID          : Integer;      { 4 character identifier }
  44.         rdb_SummedLongs : Integer;      { size of this checksummed structure }
  45.         rdb_ChkSum      : Integer;      { block checksum (longword sum to zero) }
  46.         rdb_HostID      : Integer;      { SCSI Target ID of host }
  47.         rdb_BlockBytes  : Integer;      { size of disk blocks }
  48.         rdb_Flags       : Integer;      { see below for defines }
  49.  
  50.     { block list heads }
  51.  
  52.         rdb_BadBlockList : Integer;     { optional bad block list }
  53.         rdb_PartitionList : Integer;    { optional first partition block }
  54.         rdb_FileSysHeaderList : Integer; { optional file system header block }
  55.         rdb_DriveInit   : Integer;      { optional drive-specific init code }
  56.  
  57.                                 { DriveInit(lun,rdb,ior): "C" stk & d0/a0/a1 }
  58.  
  59.         rdb_Reserved1   : Array [0..5] of Integer; { set to $ffffffff }
  60.  
  61.     { physical drive characteristics }
  62.  
  63.         rdb_Cylinders   : Integer;      { number of drive cylinders }
  64.         rdb_Sectors     : Integer;      { sectors per track }
  65.         rdb_Heads       : Integer;      { number of drive heads }
  66.         rdb_Interleave  : Integer;      { interleave }
  67.         rdb_Park        : Integer;      { landing zone cylinder }
  68.         rdb_Reserved2   : Array [0..2] of Integer;
  69.         rdb_WritePreComp : Integer;     { starting cylinder: write precompensation }
  70.         rdb_ReducedWrite : Integer;     { starting cylinder: reduced write current }
  71.         rdb_StepRate    : Integer;      { drive step rate }
  72.         rdb_Reserved3   : Array [0..4] of Integer;
  73.  
  74.     { logical drive characteristics }
  75.  
  76.         rdb_RDBBlocksLo : Integer;      { low block of range reserved for hardblocks }
  77.         rdb_RDBBlocksHi : Integer;      { high block of range for these hardblocks }
  78.         rdb_LoCylinder  : Integer;      { low cylinder of partitionable disk area }
  79.         rdb_HiCylinder  : Integer;      { high cylinder of partitionable data area }
  80.         rdb_CylBlocks   : Integer;      { number of blocks available per cylinder }
  81.         rdb_AutoParkSeconds : Integer;  { zero for no auto park }
  82.         rdb_Reserved4   : Array [0..1] of Integer;
  83.  
  84.     { drive identification }
  85.  
  86.         rdb_DiskVendor  : Array [0..7] of Char;
  87.         rdb_DiskProduct : Array [0..15] of Char;
  88.         rdb_DiskRevision : Array [0..3] of Char;
  89.         rdb_ControllerVendor : Array [0..7] of Char;
  90.         rdb_ControllerProduct : Array [0..15] of Char;
  91.         rdb_ControllerRevision : Array [0..3] of Char;
  92.         rdb_Reserved5   : Array [0..9] of Integer;
  93.     end;
  94.     RigidDiskBlockPtr = ^RigidDiskBlock;
  95.  
  96. const
  97.     IDNAME_RIGIDDISK    = $5244534B;   { RDSK }
  98.  
  99.     RDB_LOCATION_LIMIT  = 16;
  100.  
  101.     RDBFB_LAST          = 0;    { no disks exist to be configured after }
  102.     RDBFF_LAST          = $01;  {   this one on this controller }
  103.     RDBFB_LASTLUN       = 1;    { no LUNs exist to be configured greater }
  104.     RDBFF_LASTLUN       = $02;  {   than this one at this SCSI Target ID }
  105.     RDBFB_LASTTID       = 2;    { no Target IDs exist to be configured }
  106.     RDBFF_LASTTID       = $04;  {   greater than this one on this SCSI bus }
  107.     RDBFB_NORESELECT    = 3;    { don't bother trying to perform reselection }
  108.     RDBFF_NORESELECT    = $08;  {   when talking to this drive }
  109.     RDBFB_DISKID        = 4;    { rdb_Disk... identification valid }
  110.     RDBFF_DISKID        = $10;
  111.     RDBFB_CTRLRID       = 5;    { rdb_Controller... identification valid }
  112.     RDBFF_CTRLRID       = $20;
  113.                                 { added 7/20/89 by commodore: }
  114.     RDBFB_SYNCH         = 6;    { drive supports scsi synchronous mode }
  115.     RDBFF_SYNCH         = $40;  { CAN BE DANGEROUS TO USE IF IT DOESN'T! }
  116.  
  117. {------------------------------------------------------------------}
  118.  
  119. type
  120.  
  121.     BadBlockEntry = record
  122.         bbe_BadBlock    : Integer;      { block number of bad block }
  123.         bbe_GoodBlock   : Integer;      { block number of replacement block }
  124.     end;
  125.     BadBlockEntryPtr = ^BadBlockEntry;
  126.  
  127.     BadBlockBlock = record
  128.         bbb_ID          : Integer;      { 4 character identifier }
  129.         bbb_SummedLongs : Integer;      { size of this checksummed structure }
  130.         bbb_ChkSum      : Integer;      { block checksum (longword sum to zero) }
  131.         bbb_HostID      : Integer;      { SCSI Target ID of host }
  132.         bbb_Next        : Integer;      { block number of the next BadBlockBlock }
  133.         bbb_Reserved    : Integer;
  134.         bbb_BlockPairs  : Array [0..60] of BadBlockEntry; { bad block entry pairs }
  135.     { note [61] assumes 512 byte blocks }
  136.     end;
  137.     BadBlockBlockPtr = ^BadBlockBlock;
  138.  
  139. const
  140.  
  141.     IDNAME_BADBLOCK     = $42414442;   { BADB }
  142.  
  143. {------------------------------------------------------------------}
  144.  
  145. type
  146.  
  147.     PartitionBlock = record
  148.         pb_ID           : Integer;      { 4 character identifier }
  149.         pb_SummedLongs  : Integer;      { size of this checksummed structure }
  150.         pb_ChkSum       : Integer;      { block checksum (longword sum to zero) }
  151.         pb_HostID       : Integer;      { SCSI Target ID of host }
  152.         pb_Next         : Integer;      { block number of the next PartitionBlock }
  153.         pb_Flags        : Integer;      { see below for defines }
  154.         pb_Reserved1    : Array [0..1] of Integer;
  155.         pb_DevFlags     : Integer;      { preferred flags for OpenDevice }
  156.         pb_DriveName    : Array [0..31] of Char; { preferred DOS device name: BSTR form }
  157.                                         { (not used if this name is in use) }
  158.         pb_Reserved2    : Array [0..14] of Integer; { filler to 32 longwords }
  159.         pb_Environment  : Array [0..16] of Integer; { environment vector for this partition }
  160.         pb_EReserved    : Array [0..14] of Integer; { reserved for future environment vector }
  161.     end;
  162.     PartitionBlockPtr = ^PartitionBlock;
  163.  
  164. const
  165.  
  166.     IDNAME_PARTITION    = $50415254;    { PART }
  167.  
  168.     PBFB_BOOTABLE       = 0;    { this partition is intended to be bootable }
  169.     PBFF_BOOTABLE       = 1;    {   (expected directories and files exist) }
  170.     PBFB_NOMOUNT        = 1;    { do not mount this partition (e.g. manually }
  171.     PBFF_NOMOUNT        = 2;    {   mounted, but space reserved here) }
  172.  
  173. {------------------------------------------------------------------}
  174.  
  175. type
  176.  
  177.     FileSysHeaderBlock = record
  178.         fhb_ID          : Integer;      { 4 character identifier }
  179.         fhb_SummedLongs : Integer;      { size of this checksummed structure }
  180.         fhb_ChkSum      : Integer;      { block checksum (longword sum to zero) }
  181.         fhb_HostID      : Integer;      { SCSI Target ID of host }
  182.         fhb_Next        : Integer;      { block number of next FileSysHeaderBlock }
  183.         fhb_Flags       : Integer;      { see below for defines }
  184.         fhb_Reserved1   : Array [0..1] of Integer;
  185.         fhb_DosType     : Integer;      { file system description: match this with }
  186.                                 { partition environment's DE_DOSTYPE entry }
  187.         fhb_Version     : Integer;      { release version of this code }
  188.         fhb_PatchFlags  : Integer;      { bits set for those of the following that }
  189.                                 {   need to be substituted into a standard }
  190.                                 {   device node for this file system: e.g. }
  191.                                 {   0x180 to substitute SegList & GlobalVec }
  192.         fhb_Type        : Integer;      { device node type: zero }
  193.         fhb_Task        : Integer;      { standard dos "task" field: zero }
  194.         fhb_Lock        : Integer;      { not used for devices: zero }
  195.         fhb_Handler     : Integer;      { filename to loadseg: zero placeholder }
  196.         fhb_StackSize   : Integer;      { stacksize to use when starting task }
  197.         fhb_Priority    : Integer;      { task priority when starting task }
  198.         fhb_Startup     : Integer;      { startup msg: zero placeholder }
  199.         fhb_SegListBlocks : Integer;    { first of linked list of LoadSegBlocks: }
  200.                                 {   note that this entry requires some }
  201.                                 {   processing before substitution }
  202.         fhb_GlobalVec   : Integer;      { BCPL global vector when starting task }
  203.         fhb_Reserved2   : Array [0..22] of Integer; { (those reserved by PatchFlags) }
  204.         fhb_Reserved3   : Array [0..20] of Integer;
  205.     end;
  206.     FileSysHeaderBlockPtr = ^FileSysHeaderBlock;
  207.  
  208. const
  209.  
  210.     IDNAME_FILESYSHEADER        = $46534844;    { FSHD }
  211.  
  212. {------------------------------------------------------------------}
  213.  
  214. Type
  215.  
  216.     LoadSegBlock = record
  217.         lsb_ID          : Integer;      { 4 character identifier }
  218.         lsb_SummedLongs : Integer;      { size of this checksummed structure }
  219.         lsb_ChkSum      : Integer;      { block checksum (longword sum to zero) }
  220.         lsb_HostID      : Integer;      { SCSI Target ID of host }
  221.         lsb_Next        : Integer;      { block number of the next LoadSegBlock }
  222.         lsb_LoadData    : Array [0..122] of Integer;    { data for "loadseg" }
  223.     { note [123] assumes 512 byte blocks }
  224.     end;
  225.     LoadSegBlockPtr = ^LoadSegBlock;
  226.  
  227. const
  228.  
  229.     IDNAME_LOADSEG      = $4C534547;    { LSEG }
  230.  
  231.